[XEN] gnttab: Read domid/flags atomically.
authorkfraser@ubuntu.eng.hq.xensource.com <kfraser@ubuntu.eng.hq.xensource.com>
Wed, 6 Sep 2006 01:36:23 +0000 (18:36 -0700)
committerkfraser@ubuntu.eng.hq.xensource.com <kfraser@ubuntu.eng.hq.xensource.com>
Wed, 6 Sep 2006 01:36:23 +0000 (18:36 -0700)
This more neatly matches how the two adjacent fields in
the grant-table entry are accessed by the cmpxchg()
function.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
xen/common/grant_table.c

index 68e2bf62d78e7c97e228f3106555a3a2ea6b8a0d..be393d0dcb1f88702d1b4848e7f79a644429a0fd 100644 (file)
@@ -184,8 +184,7 @@ __gnttab_map_grant_ref(
          (!(op->flags & GNTMAP_readonly) &&
           !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask))) )
     {
-        scombo.shorts.flags = sha->flags;
-        scombo.shorts.domid = sha->domid;
+        scombo.word = *(u32 *)&sha->flags;
 
         /*
          * This loop attempts to set the access (reading/writing) flags
@@ -556,8 +555,7 @@ gnttab_prepare_for_transfer(
 
     sha = &rgt->shared[ref];
     
-    scombo.shorts.flags = sha->flags;
-    scombo.shorts.domid = sha->domid;
+    scombo.word = *(u32 *)&sha->flags;
 
     for ( ; ; )
     {
@@ -774,8 +772,7 @@ __acquire_grant_for_copy(
     if ( !act->pin ||
          (!readonly && !(act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask))) )
     {
-        scombo.shorts.flags = sha->flags;
-        scombo.shorts.domid = sha->domid;
+        scombo.word = *(u32 *)&sha->flags;
 
         for ( ; ; )
         {